package cn.lxycx.dataterrace.util;

import java.util.regex.Pattern;

/**
 * 常用字符串正则校验
 * @author 邢超
 * 时间：2017-5-31
 */
public class RegexStr {
	
	public static void main(String[] args) {
		System.out.println("".matches(ISCOMMON));
	}
	
	/**汉字字母数字下划线*/
	public static String ISCOMMON = "^[\\S\\s]*$";
	/**汉字字母数字*/
	public static String ISCOMMON2 = "^[\u4E00-\u9FA5A-Za-z0-9]+$";
	
	/**密码6-21位 数字+字母*/
	public static String SIMPLE_PASSWORD = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z_]{6,21}$";
	
	/**金额校验 正整数5位 小数1-2位*/
	public static String ISMONEY = "[0-9]{1,5}(\\.[0-9]{1,2})?"; 
	
	
	/**六进制*/
	public static String IS6 = "[0-5]";
	
	/**二进制*/
	public static String IS2 ="0|1";
	
	/**大数字*/
	public static String ISBIGNUMBER = "[0-9]+";
	
	/**纯数字校验,1-9位*/
	public static String ISNUMBER = "[0-9]{1,9}";
	
	/**中文姓名，2-10位*/
	public static String ISNAME = "^([\u4e00-\u9fa5]){2,10}$";
	
	/**验证码4-8位字符串或数字*/
	public static String ISYZM = "[0-9a-zA-Z]{4,8}";//已测试
	
	
	
	
	/**校验邮箱*/
	public static String EMAIL = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
	
	/**手机号*/
	public static String PHONE = "^(1[3-9][0-9])\\d{8}$";
	
	/**固定电话*/
	public static String TEL = "^(0\\d{2}-\\d{8}(-\\d{1,4})?)|(0\\d{3}-\\d{7,8}(-\\d{1,4})?)$";
	
	/**身份证*/
	public static String IDCARD = "(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])";
	
	/**url*/
	public static String URL = "[\\w- ./?%&=]+";
	/**http URL*/
	public static String HTTPURL = "http(s)?://[\\w- ./?%&=]+";
	
	/**时间：YYYY-MM-DD HH:mm:ss*/
	public static String DATETIME = "^(19|20)[0-9][0-9]-((0[1-9])|(1[0-2]))-(([0-2][1-9])|([1-3][0-1])) (([0-2][0-3])|([0-1][0-9])):[0-5][0-9]:[0-5][0-9]$";
	
	/**日期：YYYY-MM-DD*/
	public static String DATE = "^(19|20)[0-9][0-9]-((0[1-9])|(1[0-2]))-(([0-2][1-9])|([1-3][0-1]))$";
	
	/**邮政编码*/
	public static String YZCODE  = "^\\d{6}$";
	
	
}
